<!-- {{nextTitle}} -->
<form class="form-horizontal" role="form" novalidate name="stForm" ng-init="initQuery()">
  <div class="form-ctrl md-whiteframe-z1">
    <div class="form-search" style="height:270px;" ng-class="{true: 'shou'}[shoumun.flag==0]" ng-switch on="sendData.timeTypeCode">
      <!-- 时间粒度   -->
      <div>
        <label style="width:70px">时间粒度</label>
        <md-select ng-model="sendData.timeTypeCode" >
          <md-option ng-value="tim.timeTypeCode" ng-repeat="tim in selector.timeType">{{tim.timeTypeName}}</md-option>
        </md-select>
      </div>

      <div ng-switch-when="1">
        <md-input-container  flex>
          <label>开始时间</label>
          <input ng-model="selector.startTime"  type="date" end-time="selector.endTime" time-validate="day" name="kaishi" required></input>
          <div ng-messages="stForm.kaishi.$error">
            <div ng-message="date">请正确输入时间</div>
            <div ng-message="time-error">结束时间不应小于开始时间</div>
          </div>
        </md-input-container>
      </div>
      <div ng-switch-when="1">
        <md-input-container flex>
          <label>结束时间</label>
          <input ng-model="selector.endTime"  type="date" start-time="selector.startTime" time-validate="day" name="jieshu" required></input>
          <div ng-messages="stForm.jieshu.$error">
            <div ng-message="date">请正确输入时间</div>
            <div ng-message="time-error">结束时间不应小于开始时间</div>
            <div ng-message="too-great">结束时间不应大于当前时间</div>
          </div>
        </md-input-container>
      </div>


      <div ng-switch-when="0">
        <md-input-container  flex>
          <label>开始时间</label>
          <input ng-model="selector.startTime"  type="datetime-local" end-time="selector.endTime" time-validate="month" name="kaishi" required></input>
          <div ng-messages="stForm.kaishi.$error">
            <div ng-message="date">请正确输入时间</div>
            <div ng-message="time-error">结束时间不应小于开始时间</div>
          </div>
        </md-input-container>
      </div>
      <div ng-switch-when="0">
        <md-input-container flex>
          <label>结束时间</label>
          <input ng-model="selector.endTime"  type="datetime-local" start-time="selector.startTime" time-validate="month" name="jieshu" required></input>
          <div ng-messages="stForm.jieshu.$error">
            <div ng-message="date">请正确输入时间</div>
            <div ng-message="time-error">结束时间不应小于开始时间</div>
            <div ng-message="too-great">结束时间不应大于当前时间</div>
          </div>
        </md-input-container>
      </div>

      <!-- 统计范围(业务系统) -->
      <div>
        <label style="width:70px">统计范围</label>
        <md-select ng-disabled='true'  ng-model="sendData.systemName"  required>
          <md-option ng-value="sys.systemName" ng-repeat="sys in selector.system">{{sys.systemName}}</md-option>
        </md-select>
      </div>
      <!-- 渠道名称(3条业务线，天猫等) -->
      <div>
        <label style="width:70px">渠道名称</label>
        <md-select  ng-model="sendData.channelName"  required>
          <md-option ng-value="sys.channelName" ng-repeat="sys in selector.channel">{{sys.channelName}}</md-option>
        </md-select>
      </div>
      <!-- 业务名称 -->
      <div>
        <label style="width:70px">业务名称</label>
        <md-select  ng-model="sendData.businessName" ng-click="businessCha(sendData)" required>
          <md-option ng-value="bus.businessName" ng-repeat="bus in selector.business">{{bus.businessName}}</md-option>
        </md-select>
      </div>
      <!-- 区域(省份) -->
      <div>
        <label style="width:70px">区域</label>
        <md-select multiple ng-model="sendData.province" required ng-click="test(sendData.province)">
          <md-select-label>
            <!--  {{sendData.province.length  ? (sendData.province.provinceName ==='不分省' ? '不分省':_getNames(sendData.province,'provinceName',selector.province)) :selectLabel}} -->
            {{sendData.province.length  ? _getNames(sendData.province,'provinceName',selector.province) :selectLabel.selectLabel}}
          </md-select-label>
          <md-option ng-value="" ng-click="_checkAll(sendData,'province','全部')">全部(分省)</md-option>
          <md-option ng-value="" ng-click="_checkAll(sendData,'province','不分省')">全部(汇总)</md-option>
          <md-option ng-value="pro" ng-repeat="pro in selector.province">{{pro.provinceName}}</md-option>
        </md-select>
      </div>

    </div>
    <i class="glyphicon glyphicon-chevron-up shrinkage" ng-click="shoumun=0"></i>
    <md-button ng-click="shoumun.flag==1?shoumun.flag=0:shoumun.flag=1;searchST()" class="md-fab md-primary md-hue-1" aria-label="Profile">
      <i class="glyphicon glyphicon-arrow-down" style="margin-top:28px;" ng-show="shoumun.flag==0"></i>
      <i class="glyphicon glyphicon-search" ng-show="shoumun.flag==1"></i>
    </md-button>
  </div>
</form>

<div id="history" style="height:550px;" ng-show="!isBU"></div>
<div ng-show="isBU">
  <md-button class="md-raised" ng-click="isBU=!isBU">返回</md-button>
</div>
<div id="history_xiazuan" style="height:550px;" ng-show="isBU"></div>
<!-- <core-loading ng-show= 'load.flag'></core-loading> -->

